import request from '@/config/axios'
import { StudentVO } from '@/api/recruit/recruitstudent'

// 双选 VO
export interface DoubleChioceVO {
  id: number // 主键
  batchId: string // 计划ID
  recruitStudentId: string // 招生学生主键
  studentId: number // 学生ID
  mentorId: number // 导师ID
  useQuota: string // 占用指标
  starter: string // 方向
  studentStatus: string // 学生选择状态
  mentorStatus: string // 导师选择状态
  remark: string // 备注
}

// 指定学生双选详情 VO
export interface DoubleChoiceDetailVO {
  id: number // 主键
  batchId: string // 计划ID
  recruitStudentId: string // 招生学生主键
  studentId: number // 学生ID
  mentorId: number // 导师ID
  useQuota: string // 占用指标
  starter: string // 方向
  studentStatus: string // 学生选择状态
  mentorStatus: string // 导师选择状态
  remark: string // 备注
  username: string // 登录账号
  mentorName: string // 教师名称
  mentorJobCode: string // 教师工号
  mentorPhone: string // 手机号
  mentorEmail: string // 邮箱
  mentorIdentity: string // 身份证号
  mentorGender: string // 性别
  mentorTitle: string // 职称
  mentorDept: string // 研究部
  mentorWorkStatus: number // 工作状态
}

// 指定导师双选详情 VO
export interface DoubleChioceMentorDetailRespVO {
  id: number // 主键
  batchId: string // 计划ID
  recruitStudentId: string // 招生学生主键
  studentId: number // 学生ID
  mentorId: number // 导师ID
  useQuota: string // 占用指标
  starter: string // 方向
  studentStatus: string // 学生选择状态
  mentorStatus: string // 导师选择状态
  remark: string // 备注
  studentName: string // 学生姓名
  recruitType: string // 报名类型
  phone: string // 手机号码
  batch: string // 招生计划
  recruitStatus: string // 报名状态
  recruitTime: Date // 报名时间
  interviewQuality: string // 面试资格
}

// 导师双选计划情况 VO
export interface DoubleChioceMyBatchInfoRespVO {
  batchId: string // 计划ID
  quota1: number // 保障性指标
  quota2: number // 竞争性指标
  quota3: number // 奖励性指标
  quota4: number // 博士指标
  quota5: number // 优秀学生奖励指标
  quota1Remaining: number // 保障性指标剩余
  quota2Remaining: number // 竞争性指标剩余
  quota3Remaining: number // 奖励性指标剩余
  quota4Remaining: number // 博士指标剩余
  quota5Remaining: number // 优秀学生奖励指标剩余
  quota1RemainingInvite: number // 保障性指标剩余邀请
  quota2RemainingInvite: number // 竞争性指标剩余邀请
  quota3RemainingInvite: number // 奖励性指标剩余邀请
  quota4RemainingInvite: number // 博士指标剩余邀请
  quota5RemainingInvite: number // 优秀学生奖励指标剩余邀请
  choose: number // 已选择学生
  apply: number // 学生已申请
  remaining: number // 剩余选择学生
}

// 导师查看双选 VO
export interface DoubleChioceMentorRespVO extends StudentVO {
  groupName: string //面试分组
  batchName: string //招生计划
  confirmJudges: string //面试成绩确认评委
  mentorName: string //双选选择导师
  choiceId: number // 双选主键
  batchId: string // 计划ID
  recruitStudentId: string // 招生学生主键
  studentId: number // 学生ID
  mentorId: number // 导师ID
  useQuota: string // 占用指标
  starter: string // 方向
  studentStatus: string // 学生选择状态
  mentorStatus: string // 导师选择状态
}

// 双选 API
export const DoubleChioceApi = {
  // 查询双选分页
  getDoubleChiocePage: async (params: any) => {
    return await request.get({ url: `/recruit/double-chioce/page`, params })
  },

  // 查询双选详情
  getDoubleChioce: async (id: number) => {
    return await request.get({ url: `/recruit/double-chioce/get?id=` + id })
  },

  // 新增双选
  createDoubleChioce: async (data: DoubleChioceVO) => {
    return await request.post({ url: `/recruit/double-chioce/create`, data })
  },

  // 修改双选
  updateDoubleChioce: async (data: DoubleChioceVO) => {
    return await request.put({ url: `/recruit/double-chioce/update`, data })
  },

  // 删除双选
  deleteDoubleChioce: async (id: number) => {
    return await request.delete({ url: `/recruit/double-chioce/delete?id=` + id })
  },

  // 导出双选 Excel
  exportDoubleChioce: async (params) => {
    return await request.download({ url: `/recruit/double-chioce/export-excel`, params })
  },

  // 获得指定学生双选详情分页
  getDoubleChioceDetailPage: async (params: any) => {
    return await request.get({ url: `/recruit/double-chioce/detail-page`, params })
  },

  // 获得指定导师双选详情分页
  getDoubleChioceMentorDetailPage: async (params: any) => {
    return await request.get({ url: `/recruit/double-chioce/mentor-detail-page`, params })
  },

  // 解除双选
  revokeDoubleChioce: async (id: number) => {
    return await request.delete({ url: `/recruit/double-chioce/revoke?id=` + id })
  },

  // 解除邀请
  revokeDoubleChioceInvite: async (id: number) => {
    return await request.delete({ url: `/recruit/double-chioce/revoke-invite?id=` + id })
  },

  // 管理员直接绑定双选
  bindDoubleChioce: async (data: Partial<DoubleChioceVO>) => {
    return await request.post({ url: `/recruit/double-chioce/bind`, data })
  },

  // 导师获得指定计划双选情况
  myBatchInfo: async (batchId: string) => {
    return await request.get({ url: `/recruit/double-chioce/my-batch-info?batchId=${batchId}` })
  },

  // 导师获得双选分页
  getDoubleChioceMentorPage: async (params: any) => {
    return await request.get({ url: `/recruit/double-chioce/mentor-page`, params })
  },

  // 导师获得学生申请分页
  getDoubleChioceMentorRequestPage: async (params: any) => {
    return await request.get({ url: `/recruit/double-chioce/request-page`, params })
  },

  // 导师获得我的学生
  getDoubleChioceStudentPage: async (params: any) => {
    return await request.get({ url: `/recruit/double-chioce/student-page`, params })
  },

  // 导师选择学生 内部会判断是否学生先选了 需要传batchId recruitStudentId useQuota
  mentorDoubleChioce: async (data: Partial<DoubleChioceVO>) => {
    return await request.post({ url: `/recruit/double-chioce/mentor-select`, data })
  },

  // 导师同意或拒绝学生 需要传id recruitStudentId useQuota(同意才有) mentorStatus 同意走上面的mentorDoubleChioce了 这个只用来拒绝
  mentorDecisionDoubleChioce: async (data: Partial<DoubleChioceVO>) => {
    return await request.post({ url: `/recruit/double-chioce/mentor-decision`, data })
  }
}
